package com.ch_linghu.fanfoudroid.data;

import java.util.Date;

import android.os.Parcel;
import android.os.Parcelable;

public class User implements Parcelable {
	
	public String id;
	public String uid;
	public String uname;
	public String province;
	public String city;
	public String location;
	public String face;
	public String sex;
	public int weiboCount;
	public int followersCount;
	public int followedCount;
	public int isVerified;
	
	public String content;
	public String isFollowed;
	public boolean isProtected;
 

 

	public User() {
	}

	public static User create(com.ch_linghu.fanfoudroid.fanfou.User u) {
		User user = new User();

		user.id = u.getId();
		user.uname = u.getUname();
		user.province =u.getProvince();
		user.city =u.getCity();
		user.location = u.getLocation();
		user.face = u.getFace().toString();
		user.sex = u.getSex();
	 
		user.weiboCount = u.getWeiboCount();
		user.followersCount = u.getFollowersCount();
		user.followedCount = u.getFollowedCount();

		user.isVerified = u.getIsVerified();
		
		user.content =u.getContent();
		user.isFollowed = u.getIsFollowed();
		
 

		return user;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
	//	boolean[] boolArray = new boolean[] {  isFollowing };
		out.writeString(id);
		out.writeString(uname);
		out.writeString(province);
		out.writeString(city);
		out.writeString(location);
		out.writeString(face);
		out.writeString(sex);
		//out.writeBooleanArray(boolArray);
		out.writeInt(weiboCount);
		out.writeInt(followersCount);
		out.writeInt(followedCount);
		out.writeInt(isVerified);
		out.writeString(content);
		out.writeString(isFollowed);
		 
	}

	public static final Parcelable.Creator<User> CREATOR = new Parcelable.Creator<User>() {
		public User createFromParcel(Parcel in) {
			return new User(in);
		}

		public User[] newArray(int size) {
			// return new User[size];
			throw new UnsupportedOperationException();
		}
	};

	public User(Parcel in) {
		//boolean[] boolArray = new boolean[] {  isFollowing };
		id = in.readString();
		uname = in.readString();
		province = in.readString();
		city = in.readString();
		location = in.readString();
		face = in.readString();
		sex = in.readString();
		//in.readBooleanArray(boolArray);
		weiboCount = in.readInt();
		followersCount = in.readInt();
		followedCount = in.readInt();
		isVerified =in.readInt();
		content = in.readString();
		isFollowed = in.readString();
		//isProtected = boolArray[0];
		//isFollowing = boolArray[0];
	}
}
